package com.crm.system.controller.callCenter;

import com.crm.common.model.DataResponse;
import com.crm.common.model.DhResponse;
import com.crm.common.model.Enum.ResponseCodeEnum;
import com.crm.system.service.callCenter.CallFormService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 报表中心-呼叫报表
 * @Author renshaorong
 * @Date 2021/4/16
 */
@RestController
@RequestMapping("/callReport")
@Slf4j
public class CallReportController {

    @Autowired
    private CallFormService callFormService;

    /**
     * 折线图（接听、未接听、接听总数三条折线）
     * @Author renshaorong
     * @Date 2021/4/16
     * @param dateUnit 上月/本周/本月/本季度/本年
     * @return
     */
    @PostMapping("getPolyLineByAnswers")
    public DataResponse getPolyLineByAnswers(@RequestParam(value = "dateUnit") Integer dateUnit){
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),callFormService.getPolyLineByAnswers(dateUnit));
    }

    /**
     * 饼状图（30s/60s/90s/大于90s）
     * @Author renshaorong
     * @Date 2021/4/16
     * @param dateUnit 上月/本周/本月/本季度/本年
     * @return
     */
    @PostMapping("getMinutePieData")
    public DataResponse getMinutePieData(@RequestParam(value = "dateUnit") Integer dateUnit){
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),callFormService.getMinutePieData(dateUnit));
    }

    /**
     * 统计表（标签：1 意向电话 2 无意向电话 3 未标记电话 4 抽取标签电话 5 产生话术电话 6 恶意回复电话）
     * @Author renshaorong
     * @Date 2021/4/16
     * @param dateUnit
     * @return
     */
    @PostMapping("selectcallReportVOList")
    public DataResponse selectcallReportVOList(@RequestParam(value = "dateUnit") Integer dateUnit){
        return new DhResponse(ResponseCodeEnum.OK.getResponseCode(),callFormService.selectcallReportVOList(dateUnit));
    }
}
